package com.ljx.search.config;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author: LiJunXi
 * @Description:
 * @Date: 2024-10-04  00:15
 */
@ResponseBody
@ControllerAdvice
public class ExceptionConfig {

    @ExceptionHandler(value = ApiException.class)
    public String ApiException(ApiException exception){
        return exception.getMessage();
    }

    @ExceptionHandler(value = Exception.class)
    public String Exception(Exception exception){
        return "系统异常，请联系管理员：" + exception.getMessage();
    }
}
